﻿using System;
using System.Collections.Generic;
using System.Text;

namespace daSyntaxAnalyser.SyntaxTree
{
    using daBase.Objects;

    public class EnumCommonTypeElement : SyntaxTreeElement, ICommonTypeElement
    {
        private List<ObjectEnumCommonTypeElement> elements;

        public List<ObjectEnumCommonTypeElement> Elements { get { return elements; } set { elements = value; } }

        public EnumCommonTypeElement(TokenInfo StartInfo, List<ObjectEnumCommonTypeElement> Elements, List<TokenInfo> Comments)
            : base(StartInfo, Comments)
        {
            elements = Elements;
        }

        public override string ToString()
        {
            return string.Format("({0})", (elements != null) ? elements.Join(", ") : string.Empty);
        }

        protected override IEnumerator<ISyntaxTreeElement> CreateEnumerator()
        {
            foreach (ObjectEnumCommonTypeElement element in elements)
                yield return element;
        }
    }
}
